package org.classdef.analyzer.info.constant;

/**
 * 
 * 方法类型常量信息
 *
 */
public class MethodTypeInfo extends ConstantInfo {

	private short descriptorIndex;

	public MethodTypeInfo(short tag, short descriptorIndex) {
		super(tag);
		this.descriptorIndex = descriptorIndex;
	}

	@Override
	public Object getValue() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		sb.append("\"descriptor\":\"")
				.append(getPool().get(descriptorIndex).getValue()).append("\"");
		sb.append("}");
		return sb.toString();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		sb.append("\"tag\":").append(tag);
		sb.append(",\"descriptorIndex\":").append(descriptorIndex);
		sb.append("}");
		return sb.toString();
	}
}